<template>
	<view class="content">
		<view class="wid100 dis bacFFF foSi25 fowe800" style="height: 96rpx;">
			<view class="dis disJuC hei100" style="width: 50%;">
				<view style="height: 96rpx;" @click="xuanClick(0)">
					<view class="dis disAl disJuC" style="height: 90rpx;"
						:style="xuan == 0?'color: '+theme.main_color+';':'color: #737373;'">邀请的技师</view>
					<view class="wid80 mar" style="height: 6rpx;"
						:style="xuan == 0?'background-color: '+theme.main_color+';':'background-color: #fff;'"></view>
				</view>
			</view>
			<view class="dis disJuC hei100" style="width: 50%;">
				<view style="height: 96rpx;" @click="xuanClick(1)">
					<view class="dis disAl disJuC" style="height: 90rpx;"
						:style="xuan == 1?'color: '+theme.main_color+';':'color: #737373;'">邀请的用户</view>
					<view class="wid80 mar" style="height: 6rpx;"
						:style="xuan == 1?'background-color: '+theme.main_color+';':'background-color: #fff;'"></view>
				</view>
			</view>
		</view>
		<scroll-view style="height: calc(100vh - 100rpx);" class="wid100" scroll-y="true" @scrolltolower="lower">
			<view style="height: 1rpx;"></view>
			<block v-for="(item,index) in list" :key="index">
				<view class="wid90 mar borRad20 bacFFF mar-top30" style="box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0,0,0,0.1);padding: 30rpx 0;">
					<view class="wid90 mar dis disAl disJuB">
						<view class="dis disAl">
							<image :src="item.avatar" class="borRad50" style="width: 130rpx;height: 130rpx;"></image>
							<view class="mar-left30 ">
								<view class="foSi40 fowe800" style="line-height: 40rpx;">{{item.name}}</view>
								<view class="mar-top20 foSi30 fowe600" style="color: #717171;">{{item.phone}}</view>
							</view>
						</view>
						<view class="foSi20" style="color: #737373;">{{item.createtime}}</view>
					</view>
				</view>
			</block>
			<view style="height: 50rpx;"></view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				url: this.global.url,
				xuan: 0,
				last_page: 0,
				page: 1,
				list: [],
				theme: null
			}
		},
		onLoad() {
			this.theme = uni.getStorageSync('theme')
			this.getlist(this.xuan);
		},
		methods: {
			lower(e) {
				if(this.last_page > this.page){
					this.page++
					this.getList(this.xuan)
				}
			},
			getlist(e){
				var that = this
				uni.request({
					url: that.global.url+'api/qianyu_smfw/distr/user_tech',
					method: 'POST',
					header:{
						'site-id': that.global.site_id,//自定义请求头信息
						'token': uni.getStorageSync('token')
					},
					data: {
						is_type:e,
						page:that.page
					},
					success(res) {
						let result = res.data
						if(result.code == 1){
							that.last_page = result.data.last_page
							if(that.page == 1){
								that.list = result.data.data
							}else{
								that.list = that.list.concat(result.data.data)
							}
						}else{
							uni.showToast({
								title: result.msg,
								icon:'none',
								duration: 2000
							})
						}
					}
				})
			},
			xuanClick(index){
				if(this.xuan != index){
					this.xuan = index
					this.list = [];
					this.page = 1
					this.getlist(this.xuan);
				}
			},
			lower(e) {
				if(this.last_page > this.page){
					this.page++
					this.getList()
				}
			},
			tiaozhuan(url) {
				uni.navigateTo({
					url: url
				})
			}
		}
	}
</script>

<style>
	.content {
		min-height: 100vh;
		background-color: #F2F2F2;
	}
</style>
